package com.eastfair.venuebooking.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.eastfair.boot.request.PageParams;
import com.eastfair.boot.service.SuperService;
import com.eastfair.venuebooking.dto.*;
import com.eastfair.venuebooking.entity.CustomerMain;
import com.eastfair.venuebooking.entity.VenueBookAudit;
import com.eastfair.venuebooking.vo.ContractHistogramVO;
import com.eastfair.venuebooking.vo.CustomerMainVO;
import com.eastfair.venuebooking.vo.CustomerStatisticsVO;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 业务接口
 * 客户表
 * </p>
 *
 * @author linan
 * @date 2022 -06-08
 */
public interface CustomerMainService extends SuperService<CustomerMain> {

    /**
     * 查询客户VO列表.
     *
     * @param params the params
     * @return the page
     */
    IPage<CustomerMainVO> listCustomerMainVOs(PageParams<CustomerMainQuery> params);

    /**
     * 查询待同步到cms的客户.
     *
     * @return the list
     */
    List<CustomerMainVO> listWaitCmsSync();

    /**
     * id 获取客户详情.
     *
     * @param id the id
     * @return the customer main vo
     */
    CustomerMainVO getCustomerMainVOById(Long id);

    /**
     * 通过联系人id查询客户.
     *
     * @param contactId the contact id
     * @return the customer main
     */
    CustomerMain getCustomerByContactId(Long contactId);

    /**
     * 查询客户统计信息.
     *
     * @param id the id
     * @return the customer statistics
     */
    CustomerStatisticsVO getCustomerStatistics(Long id);

    /**
     * 客户名称查询客户.
     *
     * @param customerName the customer name
     * @return the customer by name
     */
    CustomerMain getCustomerByName(String customerName);

    /**
     * 统一信用代码查询客户.
     *
     * @param uscc the uscc
     * @return the customer by uscc
     */
    CustomerMain getCustomerByUscc(String uscc);

    /**
     * 查询客户.
     *
     * @param customerMainDTO the customer main dto
     * @return the customer
     */
    CustomerMain getCustomer(CustomerMainDTO customerMainDTO);

    /**
     * 客户ID查询每年的成交量.
     *
     * @param id the id
     * @return the list
     */
    List<ContractHistogramVO> countEveryYearContractAmountById(Long id);

    /**
     * 保存客户.
     *
     * @param saveDTO the save dto
     * @return the customer main
     */
    boolean saveCustomerMain(CustomerMainContactSaveDTO saveDTO);

    /**
     * 场馆预定审核通过生成客户，联系人.
     *
     * @param venueBookAuditDTO the website venue book dto
     * @return the boolean
     */
    Map<String, Object> saveForVenueBook(VenueBookAudit venueBookAuditDTO);

    /**
     * 客户转入公海.
     *
     * @param publicDTO the public dto
     * @return the boolean
     */
    boolean updatePublic(CustomerMainPublicDTO publicDTO);

    /**
     * 分配客户，更新归属记录.
     *
     * @param assignDTO the assign dto
     * @return the boolean
     */
    boolean updateBelongTo(CustomerMainAssignDTO assignDTO);

    /**
     * 批量更新归属人.
     *
     * @param assignDTO the assign dto
     * @return the boolean
     */
    boolean updateBelongTo(List<CustomerMainAssignDTO> assignDTO);

    /**
     * 更新为静默.
     *
     * @param customerMainDTO the customer main dto
     * @return the boolean
     */
    boolean updateSilence(CustomerMainDTO customerMainDTO);

    /**
     * 更新 客户 state.
     *
     * @param updateDTO the update dto
     * @return the boolean
     */
    boolean updateState(CustomerMainDTO updateDTO);

    /**
     * 更新客户跟进状态.
     *
     * @param updateDTO the save dto
     * @return the boolean
     */
    boolean updateFollow(CustomerMainDTO updateDTO);

    /**
     * 更新客户跟进状态.
     *
     * @param followRecordPlanSaveDTO the follow record plan save dto
     * @return the boolean
     */
    boolean updateFollow(FollowRecordPlanSaveDTO followRecordPlanSaveDTO);

    /**
     * 关注/取关 客户.
     *
     * @param startDTO the start dto
     * @return the boolean
     */
    boolean updateStartCustomerMain(CustomerMainStartDTO startDTO);

    /**
     * 更新客户cms同步状态.
     *
     * @param customerMainDTO the customer main dto
     * @return the boolean
     */
    boolean updateCrmSync(CustomerMainDTO customerMainDTO);

    /**
     * 更新客户crm同步状态为已同步.
     *
     * @param ids the ids
     * @return the boolean
     */
    boolean updateCrmHasSync(List<Long> ids);

    /**
     * 批量移除用户.
     *
     * @param ids the ids
     * @return the boolean
     */
    boolean removeCustomerMainByIds(List<Long> ids);
}
